package cn.xo68.metadata.service;

import lombok.extern.slf4j.Slf4j;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.xo68.metadata.entity.MetadataProject;
import cn.xo68.metadata.mapper.MetadataProjectMapper;



/** 
 * MetadataProject Service
 * @author wuyy(16349023@qq.com)
 * @date 2020年03月12日 11:44:16
 *
 */
@Slf4j
@Service
public class MetadataProjectService{
    
    @Autowired
    private MetadataProjectMapper metadataProjectMapper;

    public MetadataProject find(Integer projectId) {
        return  metadataProjectMapper.find(projectId);
    }

    public MetadataProject insert(MetadataProject metadataProject) {
        metadataProjectMapper.insert(metadataProject);
        return metadataProject;
    }

    public MetadataProject update(MetadataProject metadataProject) {
        metadataProjectMapper.update(metadataProject);
        return metadataProject;
    }
    
    public int delete(Integer projectId) {
        return metadataProjectMapper.delete(projectId);
    }
    
    public List<MetadataProject> list() {
        return metadataProjectMapper.list();
    }
	
	public PageInfo<MetadataProject> list(int pageNumber,int pageSize) {
        PageHelper.startPage(pageNumber, pageSize,true);
        List<MetadataProject> docs = metadataProjectMapper.list();
        PageInfo<MetadataProject> pageInfo = new PageInfo<MetadataProject>(docs);
        return pageInfo;
    }
}